package com.component.code;

import java.util.ArrayList;

import net.sf.json.JSONObject;

import com.component.mode.Button;
import com.component.mode.ReturnInfo;



@SuppressWarnings("serial")
public class TishiManager {
	
	//消息展示模式
	/** 标准弹窗 **/
	public static String WINDOW_T = "T";
	/** 浮动窗（浮动几秒后自动消失）**/
	public static String WINDOW_F = "F";
	/** 飘窗（从边缘进入，中间停留，然后再出去）**/
	public static String WINDOW_P = "P";
	
	public static final int tishiButton_close = -1; // ---关闭
	public static final int tishiButton_ok = 0;        //---确定
	public static final int tishiButton_canel = 1;      //---取消
	public static final int tishiButton_quiteGame = 2;  //---退出应用
	public static final int tishiButton_returnHall = 10;  //---返回大厅
	
	public final static String Tishi_T_ReConn_Fail = getTishiT("重连失败", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_Token_Fail = getTishiT("账号检测失败", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_GetPlayerInfo_Fail = getTishiT("获取玩家信息失败", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_SecondLogin = getTishiT("您的账号在其它地方登录了,您被挤出游戏,请检查是否是本人行为", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_JoinRoom_Fail = getTishiT("进入房间失败", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_JoinDesk_Fail = getTishiT("进入桌子失败", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_No_Seat = getTishiT("该场已无空位置啦,请换个场玩玩", WINDOW_T, new ArrayList<Button>() {
		{			
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_HavePlayer = getTishiT("该桌位已经被别人抢先一步啦", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_Room_Close = getTishiT("该房间暂时关闭,请稍后再试", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_MoneyTooHigh = getTishiT("金币已超出该房间限制", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	public final static String Tishi_T_MoneyTooLow = getTishiT("金币不足该房间最低要求", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	
	public final static String Tishi_T_MoneyException = getTishiT("金币异常", WINDOW_T, new ArrayList<Button>() {
		{
			add(new Button(tishiButton_returnHall, null));
		}
	});
	
	public final static String Tishi_F_Game_IllBet = getTishiT("非法下注", WINDOW_F, null);
	public final static String Tishi_F_Game_RepeatBet = getTishiT("重复下注", WINDOW_F, null);
	public final static String Tishi_F_Game_LowMoney = getTishiT("背包金币不足", WINDOW_F, null);
	public final static String Tishi_F_Game_OutBetTime = getTishiT("无法下注", WINDOW_F, null);
	public final static String Tishi_F_Game_totalBetLimit = getTishiT("当前总投注已达上限", WINDOW_F, null);
	public final static String Tishi_F_Game_subBetLimit = getTishiT("当前区域总投注已达上限", WINDOW_F, null);
	
	// 维护系统
	public final static String Tishi_Send_Success = getTishiT("发送成功", WINDOW_F, null);
	public final static String Tishi_Read_Success = getTishiT("读取成功", WINDOW_F, null);
	public final static String Tishi_Close_Success = getTishiT("关闭成功", WINDOW_F, null);
	public final static String Tishi_Close_Fail = getTishiT("关闭失败", WINDOW_F, null);
	public final static String Tishi_Modity_Fail = getTishiT("修改失败",WINDOW_F, null);
	public final static String Tishi_Modity_Success = getTishiT("修改成功", WINDOW_F, null);

	public static String getTishiT(String value, String type, ArrayList<Button> buttons) {
		ReturnInfo rInfo = new ReturnInfo();
		rInfo.setType(type);
		rInfo.setInfo(value);

		if (buttons != null) {
			for (int i = 0; i < buttons.size(); i++) {
				Button button = buttons.get(i);
				rInfo.addButton(button);
			}
		}
		return JSONObject.fromObject(rInfo).toString();
	}

}
